#ifndef RAYTRACER_H
#define RAYTRACER_H

#include "common.h"
#include "scene.h"
#include "camera.h"
#include "object.h"

struct RayTracer{
    RayTracer(Scene *scene, Camera *camera):scene(scene), camera(camera){
        antiAliasing = 0;
        refDep = 0;
    }
    Scene* scene;
    Camera* camera;
    int H, W;
    int antiAliasing;
    int refDep;
    void setHW(int h, int w){
        H = h;
        W = w;
        camera->setHW(h, w);
    }

    void startRayTracing();
    RGB getColor(const Ray &ray, int reflectDepth);
    void outputBmp();
    void outputOpencv();
    void calcDiffuse(RGB &finalColor, const Ray &ray, const Vec &P, const Vec &N, const Material& material);
    void calcReflect(RGB &finalColor, const Ray &ray, const Vec &P, const Vec &N, const Material& material, int depth);

};


#endif // RAYTRACER_H

